package com.users.rn.kit.bridge.impl.route

import android.app.Activity
import com.users.rn.kit.RNKITTools
import com.users.rn.kit.RNKitManager
import com.users.rn.kit.bridge.RNBasicJavaModule
import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactMethod
import com.facebook.react.bridge.ReadableMap
import java.util.ArrayList

/**
 * 作者：wolf on 12/22/20 15:50
 * 邮箱：bluce
 */

class KitRouterBridge constructor(context: ReactApplicationContext) :
    RNBasicJavaModule<KitRouterModule>(context) {

    override fun getBridge(): KitRouterModule? {
        return RNKitManager.get(KitRouterModule.RN_MODULE_NAME)
    }

    override fun getName(): String {
        return KitRouterBridge::class.java.simpleName
    }

    @ReactMethod
    fun push(
        pluginId: String,
        componentName: String,
        pageTag: String,
        params: ReadableMap
    ) {
        rnBridge?.openRNPage(context, pluginId, componentName, pageTag, params)
    }

    @ReactMethod
    fun pop(pageTag: String) {
        currentActivity?.finish()
    }

    @ReactMethod
    fun dispatchScheme(scheme: String, pageTag: String, promise: Promise) {
        rnBridge?.dispatchScheme(context, scheme, pageTag, promise)
    }

    @ReactMethod
    fun getEnvironmentNavigationHeight(params: ReadableMap,promise: Promise){
        rnBridge?.getEnvironmentNavigationHeight(params,promise)
    }

    @ReactMethod
    fun setEnvironmentStatusType(params: ReadableMap){
        rnBridge?.setEnvironmentStatusType(context,params)
    }

    @ReactMethod
    fun toNativeGeneralAction(params: ReadableMap,promise: Promise){
        rnBridge?.toNativeGeneralAction(context,params,promise)
    }

    @ReactMethod
    fun getImageAction(params: ReadableMap,promise: Promise){
        rnBridge?.getImageAction(context,params,promise)
    }

    @ReactMethod
    fun showPickView(params: ReadableMap,promise: Promise){
        rnBridge?.showPickView(context,params,promise)
    }

    @ReactMethod
    fun showNativeScan(params: ReadableMap,promise: Promise){
        rnBridge?.showNativeScan(context,params,promise)
    }

    @ReactMethod
    fun threePartiesLogin(params: ReadableMap,promise: Promise){
        rnBridge?.threePartiesLogin(context,params,promise)
    }

    @ReactMethod
    fun getLocationInformation(params: ReadableMap,promise: Promise){
        rnBridge?.getLocationInformation(context,params,promise)
    }

    @ReactMethod
    fun openTelprompt(params: ReadableMap,promise: Promise){
        rnBridge?.openTelprompt(context,params,promise)
    }

    @ReactMethod
    fun openNativeWeb(params: ReadableMap,promise: Promise){
        rnBridge?.openNativeWeb(context,params,promise)
    }

    @ReactMethod
    fun openCustomerService(params: ReadableMap,promise: Promise){
        rnBridge?.openCustomerService(context,params,promise)
    }

    @ReactMethod
    fun sendMessageVoice(params: ReadableMap,promise: Promise){
        rnBridge?.sendMessageVoice(context,params,promise)
    }
    @ReactMethod
    fun openPhotographPreviewAction(params: ReadableMap,promise: Promise){
        rnBridge?.openPhotographPreviewAction(context,params,promise)
    }
    @ReactMethod
    fun openAppletsAction(params: ReadableMap,promise: Promise){
        rnBridge?.openAppletsAction(context,params,promise)
    }
    @ReactMethod
    fun savepicture(params: ReadableMap,promise: Promise){
        rnBridge?.savepicture(context,params,promise)
    }

}
